-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[METRICS] use built-in cost functions to fetch beans #1622
Conversation
Collection<BeanQuery> QUERIES = | ||
Stream.of( | ||
LogMetrics.QUERIES.stream(), | ||
LogMetrics.QUERIES.stream(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
這裡出現重複的 query 。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感謝!
你這個建議倒是提醒了另一件事情,你覺得我們這些內建的query中有沒有查找到重複內容?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
看起來 domain name 就不重複了,應該沒有拉到重複的內容。
另外也有實際測試過了,沒有重複。
@Test
void testing(){
try (var client = MBeanClient.jndi("localhost", 7091)){
Set<Map<String, String>> exist = new HashSet<>();
MetricFetcher.QUERIES.forEach(q -> client.beans(q).forEach(bean ->{
if (exist.contains(bean.properties())){
System.out.println(" same properties for: "+ bean.properties());
}else {
exist.add(bean.properties());
}
}));
System.out.println("All beans:"+exist.size());
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
這個例子看起來不錯,我把它加入PR
取代原本索取全部 metrics 的設計,這邊用內建的 cost functions 的查詢條件來索取,”理論上“會少垃很多資料